package pubsub;

import org.atmosphere.cpr.AtmosphereResourceEvent;
import org.atmosphere.cpr.AtmosphereResourceEventListener;

public class EventsLogger implements AtmosphereResourceEventListener {

    public EventsLogger() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void onPreSuspend(AtmosphereResourceEvent event) {
        System.out.println("onPreSuspend: " + event);
    }

    public void onSuspend(final AtmosphereResourceEvent event) {
        System.out.println("onSuspend: " + event);
    }

    public void onResume(AtmosphereResourceEvent event) {
        System.out.println("onResume: " + event);
    }

    public void onDisconnect(AtmosphereResourceEvent event) {
        System.out.println("onDisconnect: " + event);
    }

    public void onBroadcast(AtmosphereResourceEvent event) {
        System.out.println("onBroadcast: " + event);
    }

    public void onHeartbeat(AtmosphereResourceEvent event) {
        System.out.println("onHeartbeat: " + event);
    }

    public void onThrowable(AtmosphereResourceEvent event) {
        event.throwable().printStackTrace(System.err);
    }

    @Override
    public void onClose(AtmosphereResourceEvent event) {
        System.out.println("onClose: " + event);
    }
}